package camel.corp.universalcopy;

import a.f.i.z;
import android.animation.AnimatorListenerAdapter;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.SpannableString;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.a;
import androidx.appcompat.app.o;
import androidx.appcompat.widget.Toolbar;
import com.camel.corp.universalcopy.B;
import com.camel.corp.universalcopy.CopyActivity;
import com.camel.corp.universalcopy.E;
import com.camel.corp.universalcopy.H;
import com.camel.corp.universalcopy.a.k;
import com.camel.corp.universalcopy.c;
import com.camel.corp.universalcopy.e;
import com.camel.corp.universalcopy.g;
import com.camel.corp.universalcopy.h;
import com.camel.corp.universalcopy.i;
import com.camel.corp.universalcopy.j;
import com.camel.corp.universalcopy.k;
import com.camel.corp.universalcopy.l;
import com.camel.corp.universalcopy.m;
import com.camel.corp.universalcopy.ma;
import com.camel.corp.universalcopy.n;
import com.camel.corp.universalcopy.o;
import com.camel.corp.universalcopy.q;
import com.camel.corp.universalcopy.r;
import com.camel.corp.universalcopy.s;
import com.camel.corp.universalcopy.t;
import com.camel.corp.universalcopy.u;
import com.camel.corp.universalcopy.v;
import com.camel.corp.universalcopy.x;
import com.camel.corp.universalcopy.y;
import com.camel.corp.universalcopy.z;
import com.crashlytics.android.Crashlytics;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.i;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
// this is the core thing.
// creating starts here.
// where are those things?
public class CopyActivity extends k {
  private View A;
  
  private View B;
  
  private Toolbar C;
  
  private Menu D;
  
  private List<H> E;
  
  private a F;
  
  private int G = 0;
  
  private int H = 0;
  
  private int I = 0;
  
  private int J = 0;
  
  private i K;
  
  private boolean L = false;
  
  private boolean M = false;
  
  private boolean N = false;
  
  private boolean O = false;
  
  private boolean P = true;
  
  private boolean Q = false;
  
  private int R = 0;
  
  private FrameLayout u;
  
  private FloatingActionButton v;
  
  private FloatingActionButton w;
  
  private FloatingActionButton x;
  
  private View y;
  
  private View z;
  
  private String a(TextView paramTextView) {
    // get string from the thing?
    if (paramTextView == null)
      return q(); 
    CharSequence charSequence = paramTextView.getText();
    int j = paramTextView.getSelectionStart();
    int m = paramTextView.getSelectionEnd();
    if (j == m)
      return charSequence.toString(); 
    try {
      CharSequence charSequence1 = charSequence.subSequence(j, m);
      if (charSequence1 != null)
        return charSequence1.toString(); 
    } catch (StringIndexOutOfBoundsException paramTextView) {
      Crashlytics.a(paramTextView);
    } 
    return charSequence.toString();
  }
  
  private void a(AnimatorListenerAdapter paramAnimatorListenerAdapter) {
    this.z.setVisibility(0);
    this.y.setVisibility(0);
    this.A.setVisibility(0);
    this.B.setVisibility(0);
    this.u.setBackgroundColor(570425344);
    if (this.P) {
      this.z.setScaleX(0.0F);
      this.z.animate().scaleX(1.0F).setDuration(300L);
      int j = ma.a(getWindowManager());
      View view = this.B;
      float f = j;
      view.setTranslationY(f);
      this.B.animate().setInterpolator(new AccelerateInterpolator()).translationY(0.0F).setStartDelay(200L).setDuration(400L);
      this.A.setTranslationY(f);
      this.A.animate().setInterpolator(new AccelerateInterpolator()).translationY(0.0F).setStartDelay(200L).setDuration(400L);
      this.y.setScaleX(0.0F);
      this.y.animate().scaleX(1.0F).setInterpolator(new AccelerateInterpolator()).setStartDelay(300L).setDuration(300L);
      ObjectAnimator objectAnimator = ObjectAnimator.ofObject(this.u, "backgroundColor", new ArgbEvaluator(), new Object[] { Integer.valueOf(16777215), Integer.valueOf(-570425345) });
      objectAnimator.setInterpolator(new DecelerateInterpolator());
      objectAnimator.setDuration(400L).start();
      objectAnimator = ObjectAnimator.ofObject(this.u, "backgroundColor", new ArgbEvaluator(), new Object[] { Integer.valueOf(-570425345), Integer.valueOf(570425344) });
      objectAnimator.setInterpolator(new AccelerateInterpolator());
      objectAnimator.setStartDelay(400L);
      objectAnimator.setDuration(300L).start();
      objectAnimator.addListener(paramAnimatorListenerAdapter);
      return;
    } 
    paramAnimatorListenerAdapter.onAnimationEnd(null);
  }
  
  private void a(TextView paramTextView, k.b paramb) { a(a(paramTextView), paramb); }
  
  private void a(E paramE, int paramInt) {
    H h = new H(this, paramE, this.F);
    h.a(this.u, paramInt);
    if (h.b())
      this.R++; 
  }
  
  private void a(k.b paramb) {
    if (this.O && !o()) {
      p();
      return;
    } 
    if (paramb != null)
      paramb.a(); 
  }
  
  private void a(String paramString) {
    ma.a(this, paramString);
    ma.a(getApplication(), "MAIN_ACTIONS", "ACTION_COPY");
    Toast.makeText(this, 2131755202, 0).show();
  }
  
  private void a(String paramString, k.b paramb) { a(new q(this, paramString, paramb)); }
  
  private void a(boolean paramBoolean1, boolean paramBoolean2) {
    Menu menu = this.D;
    if (menu != null) {
      menu.findItem(2131296306).setVisible(paramBoolean2 ^ true);
      this.D.setGroupVisible(2131296352, paramBoolean2);
    } 
    if (this.N)
      if (paramBoolean2) {
        this.w.b();
        this.x.b();
        this.v.e();
      } else {
        this.v.b();
        this.w.e();
        this.x.e();
      }  
    a a1 = l();
    if (a1 != null) {
      int j;
      if (!paramBoolean1) {
        a1.b(null);
        a1.a(null);
        a1.b(2131230850);
        return;
      } 
      if (this.O) {
        j = 2131755165;
      } else {
        j = 2131755164;
      } 
      a1.c(j);
      a1.b(2131230854);
    } 
  }
  
  private int b(TextView paramTextView) {
    int m = paramTextView.getHeight() + this.H + this.I * 2 - ma.a(this, 44);
    int n = this.G;
    int j = m;
    if (m > n)
      j = n; 
    return j;
  }
  
  private void b(AnimatorListenerAdapter paramAnimatorListenerAdapter) {
    if (!this.Q) {
      if (isFinishing())
        return; 
      this.Q = true;
      if (this.P) {
        int j = ma.a(this, 5);
        AccelerateInterpolator accelerateInterpolator = new AccelerateInterpolator();
        ViewPropertyAnimator viewPropertyAnimator = this.z.animate();
        float f = j;
        viewPropertyAnimator = viewPropertyAnimator.translationYBy(f).setInterpolator(accelerateInterpolator);
        long l = 'Ĭ';
        viewPropertyAnimator.setDuration(l);
        this.B.animate().translationXBy(f).setInterpolator(accelerateInterpolator).setDuration(l);
        this.A.animate().translationXBy(-j).setInterpolator(accelerateInterpolator).setDuration(l);
        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(this.u, "backgroundColor", new ArgbEvaluator(), new Object[] { Integer.valueOf(570425344), Integer.valueOf(0) });
        objectAnimator.setInterpolator(accelerateInterpolator);
        objectAnimator.setDuration(l).start();
        c(true);
        objectAnimator.addListener(new z(this, paramAnimatorListenerAdapter));
        return;
      } 
      if (paramAnimatorListenerAdapter != null)
        paramAnimatorListenerAdapter.onAnimationEnd(null); 
      finish();
    } 
  }
  // it requires not moving.
  // normal form -> android.view.View
  private void b(k.b paramb) { a(null, paramb); }
  
  private void b(String paramString) { a(paramString, new n(this)); }
  
  private void b(boolean paramBoolean) {
    a a1 = l();
    if (a1 != null)
      a1.d(paramBoolean); 
  }
  
  private void c(TextView paramTextView) { c(a(paramTextView)); }
  
  private void c(String paramString) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.SEND");
    intent.putExtra("android.intent.extra.TEXT", paramString);
    startActivity(intent.setType("text/plain").createChooser(intent, getResources().getText(2131755040)));
  }
  
  private void c(boolean paramBoolean) {
    if (paramBoolean) {
      this.C.animate().translationY((-this.I - r())).alpha(0.0F).setInterpolator(new AccelerateInterpolator()).setDuration(300L).setListener(new y(this));
      return;
    } 
    f(false);
  }
  
  private void d(boolean paramBoolean) {
    this.N = paramBoolean;
    if (paramBoolean) {
      c(true);
      w();
      return;
    } 
    e(this.P);
    this.v.b();
    this.w.b();
  }
  
  private void e(boolean paramBoolean) {
    if (paramBoolean) {
      this.C.setTranslationY((-this.I - r()));
      this.C.setAlpha(0.0F);
      this.C.animate().translationY(0.0F).alpha(1.0F).setInterpolator(new DecelerateInterpolator()).setDuration(300L);
    } 
    f(true);
  }
  
  private void f(boolean paramBoolean) {
    a a1 = l();
    if (a1 != null) {
      if (paramBoolean) {
        a1.m();
        return;
      } 
      a1.i();
    } 
  }
  
  private String q() {
    StringBuilder stringBuilder = new StringBuilder();
    byte b = 0;
    while (b < this.E.size()) {
      stringBuilder.append(((H)this.E.get(b)).getText());
      byte b1 = b + 1;
      b = b1;
      if (b1 < this.E.size()) {
        stringBuilder.append("\n");
        b = b1;
      } 
    } 
    return stringBuilder.toString();
  }
  
  private int r() {
    if (this.J == 0) {
      int j = getResources().getIdentifier("status_bar_height", "dimen", "android");
      if (j > 0) {
        this.J = getResources().getDimensionPixelSize(j);
      } else {
        this.J = (int)Math.ceil(((getResources().getDisplayMetrics()).density * 25.0F));
      } 
    } 
    return this.J;
  }
  
  private void s() {
    boolean bool;
    if (this.E.size() < this.R) {
      bool = true;
    } else {
      bool = false;
    } 
    this.E.clear();
    for (byte b = 0; b < this.u.getChildCount(); b++) {
      View view = this.u.getChildAt(b);
      if (view instanceof H) {
        H h = (H)view;
        if (h.b()) {
          h.a(bool, false);
          if (bool)
            this.E.add(h); 
        } else {
          h.a(false, false);
        } 
      } 
    } 
    Collections.sort(this.E, new b(this));
    w();
  }
  
  private void t() {
    // about creating new textview?
    this.L = false;
    a(false, false);
    // this really makes me sick.
    // asking of another tool?
    // anything or nothing magical in this?
    b(false);
    this.K = new i(this, 2131820838);
    View view = getLayoutInflater().inflate(2131492961, null);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2);
    layoutParams.topMargin = this.I - ma.a(this, 44);
    view.setLayoutParams(layoutParams);
    TextView textView = (TextView)view.findViewById(2131296528);
    textView.setText(new SpannableString(q()), TextView.BufferType.SPANNABLE);
    textView.setCustomSelectionActionModeCallback(new d(this, textView, null));
    textView.setOnTouchListener(new B(this, textView));
    ((FloatingActionButton)view.findViewById(2131296378)).setOnClickListener(new c(this, textView));
    ((FloatingActionButton)view.findViewById(2131296380)).setOnClickListener(new e(this, textView));
    this.K.setContentView(view);
    BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.b((View)view.getParent());
    this.K.setOnShowListener(new g(this, bottomSheetBehavior, textView, view));
    this.K.setOnDismissListener(new h(this));
    this.K.show();
  }
  
  private void u() { a(new m(this)); }
  
  private void v() {
    if (!this.O && Build.VERSION.SDK_INT < 21) {
      Toast.makeText(this, 2131755201, 1).show();
      return;
    } 
    b(new l(this));
  }
  
  private void w() {
    boolean bool;
    if (this.E.size() > 0) {
      bool = true;
    } else {
      bool = false;
    } 
    a(bool ^ true, bool);
  }
  // you can emulate the copy intent. drag and select.
    // or get some code online.
  public void a(boolean paramBoolean) {}
  
  public void onBackPressed() {
    if (this.E.size() > 0) {
      Iterator iterator = this.E.iterator();
      while (iterator.hasNext())
        ((H)iterator.next()).a(false, false); 
      this.E.clear();
      w();
      return;
    } 
    b(null);
  }
  
  public void onConfigurationChanged(Configuration paramConfiguration) {
    super.onConfigurationChanged(paramConfiguration);
    b(new r(this, paramConfiguration.orientation));
  }
//
  protected void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    setContentView(2131492893);
    // copy_overlay.
    int m = r();
    this.O = getIntent().getBooleanExtra("ocr_mode", false);
    this.C = (Toolbar)findViewById(2131296545);
// toolbar.
      // this is way too awful.
      // i need some renaming.
    toolbar = this.C;
    if (toolbar != null) {
      try {
        a(toolbar);
      } catch (Throwable toolbar) {}
      a arbitrary_thing = l();
      if (arbitrary_thing != null) {
        if (this.O) {
          j = 2131755165;
          // ocr_mode.
        } else {
          j = 2131755164;
          // normal mode.
        } 
        arbitrary_thing.c(j);
        arbitrary_thing.d(true);
        arbitrary_thing.b(2131230854);
      } 
    } 
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (sharedPreferences.getBoolean("night_mode", false)) {
      j = 2;
    } else {
      j = -1;
    } 
    o.d(j);
    H.setIsPreviewModeEnabled(sharedPreferences.getBoolean("preview_copy_zones", true));
    // is it true?
    this.E = new ArrayList();
    this.F = new o(this, sharedPreferences);
    this.v = (FloatingActionButton)findViewById(2131296379);
    this.v.setOnClickListener(new s(this));
    this.w = (FloatingActionButton)findViewById(2131296375);
    this.w.setOnClickListener(new t(this));
    this.x = (FloatingActionButton)findViewById(2131296518);
    FloatingActionButton floatingActionButton = this.x;
    if (this.O) {
      j = 2131230883;
    } else {
      j = 2131230896;
    } 
    floatingActionButton.setImageResource(j);
    floatingActionButton = this.x;
    if (this.O) {
      j = 2131755125;
    } else {
      j = 2131755126;
    } 
    floatingActionButton.setContentDescription(getString(j));
    this.x.setOnClickListener(new u(this));
    // i mean, is there any listener or looper here?
    this.z = findViewById(2131296331);
    this.B = findViewById(2131296469);
    this.A = findViewById(2131296408);
    this.y = findViewById(2131296548);
    int j = ma.a(getWindowManager());
    this.u = (FrameLayout)findViewById(2131296457);
    TypedValue typedValue = new TypedValue();
    if (getTheme().resolveAttribute(2130968579, typedValue, true)) {
      this.I = TypedValue.complexToDimensionPixelSize(typedValue.data, getResources().getDisplayMetrics());
      Toolbar toolbar1 = this.C;
      if (toolbar1 != null)
        ((FrameLayout.LayoutParams)toolbar1.getLayoutParams()).height = m + this.I; 
    }
    z.a(this.u, new v(this));
    this.G = j;
    this.H = ma.a(this, 132);
    // what the fuck is this one?
      // the core logic!
      // get the fucking INTENT!
    ArrayList arrayList = getIntent().getParcelableArrayListExtra("copy_nodes");
    if (arrayList != null && arrayList.size() > 0) {
      E[] arrayOfE = (E[])arrayList.toArray(new E[0]);
      Arrays.sort(arrayOfE, new c(this));
      m = arrayOfE.length;
      for (j = 0; j < m; j++)
        a(arrayOfE[j], 0); 
    } 
    overridePendingTransition(0, 0);
    this.P = sharedPreferences.getBoolean("disable_animation", false) ^ true;
    f(false);
    this.u.post(new x(this, arrayList));
  }
  
  public boolean onCreateOptionsMenu(Menu paramMenu) {
    getMenuInflater().inflate(2131558400, paramMenu);
    MenuItem menuItem = paramMenu.findItem(2131296317);
    if (menuItem != null)
      if (this.O) {
        menuItem.setTitle(2131755125);
        if (Build.VERSION.SDK_INT >= 26)
          menuItem.setTooltipText(getString(2131755203)); 
      } else {
        menuItem.setTitle(ma.a(getString(2131755126), "PLUS", getResources().getColor(2131099690)));
      }  
    this.D = paramMenu;
    return super.onCreateOptionsMenu(paramMenu);
  }
  
  public boolean onOptionsItemSelected(MenuItem paramMenuItem) {
    switch (paramMenuItem.getItemId()) {
      default:
        return false;
      case 2131296317:
        v();
        return true;
      case 2131296315:
        a(new j(this));
        return true;
      case 2131296314:
        a(new k(this));
        return true;
      case 2131296313:
        s();
        return true;
      case 2131296306:
        d(true);
        return true;
      case 2131296304:
        b(new i(this));
        return true;
      case 16908332:
        break;
    } 
    onBackPressed();
    return true;
  }
  
  protected void onPause() {
    super.onPause();
    overridePendingTransition(0, 0);
  }
}


/* Location:              D:\Users\alienware\AndroidStudioProjects\Lazero\sample\sampler\classes-dex2jar\com\camel.jar!\camel\cor\\universalcopy\CopyActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.0.7
 */